package com.drama.api.sys.order.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import com.drama.api.base.ApiIndex;
import com.drama.api.base.IDEntity;
import com.drama.api.base.R;
import com.drama.api.base.RestPage;
import com.drama.api.company.order.domain.vo.*;
import com.drama.api.company.order.service.ICompanyOrderService;
import com.drama.api.sys.order.domain.vo.SysCompanyOrderConsumeSearchVO;
import com.drama.api.sys.order.domain.vo.SysCompanyOrderConsumeVO;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;


@Api( tags = ApiIndex.SysOrderConsumeController)
@RequestMapping(value = "/api/sys/consume")
@RestController
@SaCheckLogin
public class SysOrderConsumeController {
    @Autowired
    private ICompanyOrderService service;


    @ApiOperation(value = "查询商户收益统计集合")
    @GetMapping(value = "/company_list")
    public R<RestPage<List<SysCompanyOrderConsumeVO>>>  company(
            @ApiParam(value = "查询参数") @ModelAttribute SysCompanyOrderConsumeSearchVO searchVO) {
        List<SysCompanyOrderConsumeVO> list = service.getCompanyList(searchVO);
        RestPage restPage = new RestPage(new PageInfo(list), list);
        return new R(restPage);
    }

    @ApiOperation(value = "查询收益账单统计")
    @GetMapping(value = "/count")
    public R<CompanyOrderCountVO> get_count(
            @ApiParam(value = "查询参数") @ModelAttribute CompanyOrderCountSearchVO searchVO) {
        CompanyOrderCountVO countVO = service.getCount(searchVO);
        return new R(countVO);
    }

    @ApiOperation(value = "查询收益账单统计集合")
    @GetMapping(value = "/count_list")
    public R<RestPage<List<CompanyOrderListVO>>> count_list(
            @ApiParam(value = "查询参数") @ModelAttribute CompanyOrderListSearchVO searchVO) {
        List<CompanyOrderListVO> list = service.getCountList(searchVO);
        RestPage restPage = new RestPage(new PageInfo(list), list);
        return new R(restPage);
    }


    @ApiOperation(value = "查询收益订单明细")
    @GetMapping(value = "/list")
    public R<RestPage<List<CompanyOrderVO>>> list(
            @ApiParam(value = "查询参数") @ModelAttribute CompanyOrderSearchVO searchVO) {
        List<CompanyOrderVO> list = service.getList(searchVO);
        RestPage restPage = new RestPage(new PageInfo(list), list);
        return new R(restPage);
    }


    @ApiOperation(value = "查询剧目集合")
    @GetMapping(value = "/drama_list")
    public R<List<CompanyOrderDramaVO>> drama_list(
            @ApiParam(value = "查询参数") @ModelAttribute CompanyOrderDramaSearchVO searchVO) {
        List<CompanyOrderDramaVO> list = service.getDramaList(searchVO);
        return new R(list);
    }


    @ApiOperation(value = "查询剧目详情")
    @GetMapping(value = "/drama_one")
    public R<CompanyOrderDramaVO> drama_one(@ApiParam(value = "剧目ID") @Valid @ModelAttribute IDEntity delete) {
        CompanyOrderDramaVO dramaOne = service.getDramaOne(delete.getId());
        return new R(dramaOne);
    }


}
